<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 浏览器css样式重置 
         使用*来进行浏览器样式重置，在项目中不推荐使用，因为性能差 
        */
        * {
            padding: 0;
            margin: 0;
        }

        div {
            width: 500px;
            height: 400px;
            border: 1px solid green;
            position: relative;
        }

        p {
            width: 100px;
            height: 60px;
            background: blue;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50px, -30px);
        }
    </style>
</head>

<body>
    <div>
        <p></p>
    </div>
</body>

</html>